<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/mui.picker.min.css" />
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/mui.picker.min.js"></script>
		<style>
			span{float:left; padding:0 5px;}
			.mui-query-admin ul li span{ float: left; width:80px; text-align: right; line-height: 38px;}
			.mui-table-view .mui-media-object{height:58px; width:80px;}
			.mui-table-view{background:none;}
			.bottom{
				width: 100%;
				height: 50px;
				margin-top: 10px;
				padding: 5px 0;
				bottom: 0px;
				position: fixed;
				background-color: #fff;
			}
			#buttonn{
				width: 80%;
				margin: 0 auto;
				height: 40px;
				line-height: 40px;
				text-align: center;
				background-color: #007AFF;
				border-radius: 10px;
				color: #FFFFFF;
				}
			.mui-table-view-cell{padding:15px;}
			.mui-media{margin-top:10px; background-color: #fff;}
			.mui-media-body{float: left; width: 70%;}
			.mui-media-body ul{float: left; list-style: none; padding: 0; width: 70%;}
			.mui-media-body ul li{float: left;}
			.mui-media-body ul li b{margin-right: 20px; color: #007aff; line-height: 32px; font-size: 16px; font-family: "微软雅黑";}
			.mui-media-body ul li a1{margin-right: 20px; color: #000000; line-height: 32px; font-size: 16px; font-family: "微软雅黑";}
			.mui-ellipsis{color: #999999; margin-right: 10px; line-height: 32px; font-size: 16px; font-family: "微软雅黑";}
			.mui-pull-left{width: 60px; height: 60px; margin-right: 10px; border-radius: 30px;}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title" id="list_id">列表</h1>
		</header>
		<div class="mui-conten mui-query-admin" style="margin-top:55px; padding-bottom: 55px; overflow-y: hidden;">
			<ul class="mui-table-view" id="patlist">
				
			</ul>
		</div>
		<div class="bottom" id="botdown">
			<div id="buttonn" onclick="npage()"></div>
		</div>
		<script src="../../js/mui.js"></script>
		<script src="../../js/jquery.min-1.11.1.js"></script>
		<script src="../../js/request.js"></script>
		<script type="text/javascript">
			mui.init();
			var ehrId = "";
			var bottom_name = "";
			var visitLevel = "";
			var rows = new Array;
			mui.plusReady(function(){
				var self = plus.webview.currentWebview()
					listdata = self.data
					selfdata = JSON.parse(listdata)
					console.log(self.name)
					//赋值
					ehrId = selfdata.ehrId;
					bottom_name = self.name;
					visitLevel = self.visitLevel;
					document.getElementById("list_id").innerText = bottom_name+"列表";
				$("#buttonn").text("新建"+bottom_name)	
				$.ajax({
					type: 'post',
 					url:getRequestUrl.url+"/mobile/ehr/MaternalHealth/get",
 					data:{
						ehr_id: ehrId
 						},
 					dataType:"json",
 					success : function(data) {
						rows = data.rows;
						var listcont = "";
 						if(data.status==1){
							for(var i=0; i<rows.length; i++){
								if(rows[i].visitLevel == visitLevel && visitLevel != 2){
									listcont += '<li class="mui-table-view-cell mui-media">'
											+'<a onclick="lista('+i+')" href="javascript:;">'
											+'<div class="mui-media-body">'
											+'<ul>'
											+'<li><a2 class="mui-ellipsis">所属胎次:</a2><a1>'+rows[i].parity+'</a1></li>'
											+'<li><a2 class="mui-ellipsis">随访日期:</a2><a1>'+rows[i].visitDate+'</a1></li>'
											+'<li><a2 class="mui-ellipsis">随方医生:</a2><a1>'+rows[i].doctorName+'</a1></li>'
											+'</ul>'
											+'</div>'
											+'</a>'
											+'</li>';
								}else if(rows[i].visitLevel == visitLevel && visitLevel == 2){
									listcont += '<li class="mui-table-view-cell mui-media">'
											+'<a onclick="lista('+i+')" href="javascript:;">'
											+'<div class="mui-media-body">'
											+'<ul>'
											+'<li><a2 class="mui-ellipsis">所属胎次:</a2><a1>'+rows[i].parity+'</a1><a2 class="mui-ellipsis">访次:</a2><a1>'+rows[i].visitItem+'</a1></li>'
											+'<li><a2 class="mui-ellipsis">随访/督促日期:</a2><a1>'+rows[i].visitDate+'</a1></li>'
											+'<li><a2 class="mui-ellipsis">随方医生:</a2><a1>'+rows[i].doctorName+'</a1></li>'
											+'</ul>'
											+'</div>'
											+'</a>'
											+'</li>';
								}
							}
 						}else{
 						}
						$("#patlist").append(listcont);
 					}
 				})
			})
			var i;
			function lista(i){
				var listdata_1 = JSON.stringify(rows[i])
				if(visitLevel == 1){
					mui.openWindow({
						url: 'prenatal.html', 
						id:'prenatal',
						extras:{
							data:listdata_1
						}
					});
				}
				if(visitLevel == 2){
					mui.openWindow({
						url: 'prenatal2-5.html', 
						id:'prenatal2-5',
						extras:{
							data:listdata_1
						}
					});
				}
				if(visitLevel == 3){
					mui.openWindow({
						url: 'visit.html', 
						id:'visit',
						extras:{
							data:listdata_1
						}
					});
				}
				if(visitLevel == 4){
					mui.openWindow({
						url: 'After42days.html', 
						id:'After42days',
						extras:{
							data:listdata_1
						}
					});
				}
			}
			//新建
			function npage(){
				if(visitLevel == 1){
					mui.openWindow({
						url: 'prenatal.html', 
						id:'prenatal',
						extras:{
							data:listdata
						}
					});
				}
				if(visitLevel == 2){
					mui.openWindow({
						url: 'prenatal2-5.html', 
						id:'prenatal2-5',
						extras:{
							data:listdata
						}
					});
				}
				if(visitLevel == 3){
					mui.openWindow({
						url: 'visit.html', 
						id:'visit',
						extras:{
							data:listdata
						}
					});
				}
				if(visitLevel == 4){
					mui.openWindow({
						url: 'After42days.html', 
						id:'After42days',
						extras:{
							data:listdata
						}
					});
				}
			}
		</script>
	</body>
</html>
